package com.gluck.cases.core.modal.assemble;

import com.gluck.cases.core.modal.dto.RoleDTO;
import com.gluck.cases.core.modal.entity.Role;

import java.util.Objects;

/**
 * @ClassName RoleAssemble
 * @Desc Role 组装类
 * @Author I am Gluck
 * @Date 2022/5/17 - 8:07 下午
 **/
public class RoleAssemble {

    public static Role roleDTOConvertRole(RoleDTO dto){
        Role role = new Role();
        role.setName(dto.getName());
        if(dto.getId() != 0 || !Objects.isNull(dto.getId())){
            role.setId(dto.getId());
        }
        return role;
    }

}
